package com.csoa.community.activity;

import java.text.ParseException;
import java.text.SimpleDateFormat;

import android.content.Intent;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.TextView;

import com.csoa.community.R;
import com.csoa.community.bean.RiChengModel;
import com.csoa.community.requests.RiChengRequest;

public class AlermActivity extends BaseActivity {
	
	TextView name;
	TextView time;

	@Override
	public void initUI() {
	
		setContentView(R.layout.alerm_dialog);
		name = (TextView) findViewById(R.id.ad_name);
		time = (TextView) findViewById(R.id.ad_shijian);
		RiChengModel model = (RiChengModel) getIntent().getSerializableExtra(RiChengRequest.extra_model);
		name.setText(model.name);
		
		String str = "";
		try {
			str = "开始：" + 
					(new SimpleDateFormat("yyyy-MM-dd HH:mm").format(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(model.time_start))) 
					+ " \n结束：" + 
					(new SimpleDateFormat("yyyy-MM-dd HH:mm").format(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(model.time_end)));
		} catch (ParseException e) {
			e.printStackTrace();
		} 
		time.setText(str);
		
		findViewById(R.id.ad_btn).setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) { 
				Intent intent = new Intent(AlermActivity.this, LoginActivity.class);
				intent.addFlags(Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY);
				startActivity(intent);
				finish();
			}
		});
		
		super.initUI();
	}
	
	@Override
	public void initData() {
		super.initData();
	}
	
}
